home *** CD-ROM | disk | FTP | other *** search
- /************************************************************
- * 共通一般ライブラリー OKOME System 2 *
- ************************************************************/
-
- #include <stdio.h>
- #include <string.h>
- #include <math.h>
- #include <EGB.H>
- #include <tifflib.h>
- #include <normlib.h>
-
- static xx, xx4, yy;
- static FILE *fp;
-
- int tlog(char *buf, int lof, int ls)
- {
- egbput(xx,yy+lof,xx+xx4-1,yy+lof+ls-1,buf);
- return (0);
- }
-
- int tfgs(char *buf, long sz)
- {
- fread(buf, 1, sz, fp);
- return (0);
- }
-
- int tiffload(char *name, int xf, int yf)
- {
- int x, y, comp, fill, cm;
- long strip, clut;
- char h[4096], ak[2048], tt[DECOMP_WORK_SIZE];
- xx = xf;
- yy = yf;
- if ((fp=fopen(name,"rb"))==NULL)
- return (-1);
- fread(h,1,4096,fp);
- if (TIFF_getHead(h,4096)==-1)
- {
- fclose(fp);
- return (-1);
- }
- cm = TIFF_checkMode( &x, &y, &comp, &fill, &strip, &clut);
- xx4 = x;
- if (cm != 16)
- {
- fclose(fp);
- return (cm);
- }
- TIFF_setLoadFunc(tlog,tfgs);
- TIFF_loadImage( cm, x, y, strip, fill, comp, ak, x, 1024/x, tt );
- fclose(fp);
- return (0);
- }
-